home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / falclib4.lzh / ROUTS / HLINE1.S < prev    next >
Text File  |  1994-08-11  |  7KB  |  346 lines

  1. *
  2. * HLINE1.S
  3. *
  4. *    @drawhline1
  5. *
  6. *    Draws a horizontal line in 8 bitplane mode. Clipping is implemented.
  7. *    This routine only uses the six first bitplanes.
  8. *
  9. * In    a0.l=screenadr d0=xmin d1=xmax
  10. *    d2.l - d4.l =6 bitplanes
  11. *    xres equ  horizontal screen resolution
  12. *    (destroys d0-d7/a0-a1)
  13. *
  14. * ex.     move.l    screen,a0
  15. *     move #-34,d0        left xcord
  16. *     move #67,d1        right xcord
  17. *     move.l #$0,d2        don't set bitplane 0 or 1
  18. *     move.l    #$0000ffff,d3    set bitplane 3
  19. *     move.l    #$ffffffff,d4    set bitplane 4 and 5
  20. *     bsr @drawhline1
  21. *
  22.  
  23. @drawhline1
  24.     cmp    d0,d1
  25.     bgt    .ok
  26.     move    d0,d7
  27.     move    d1,d0
  28.     move    d7,d1
  29. .ok    tst    d0
  30.     ble    .dl1
  31.     cmp    #xres-1,d1
  32.     ble    .dl4
  33.     cmp    #xres-1,d0
  34.     bgt    .ut
  35.     move    #xres-1,d1
  36. .dl4    move    d0,d5
  37.     move    d5,d7
  38.     and.l    #$fff0,d5
  39.     move    d1,d6
  40.     and    #$fff0,d6
  41.     cmp    d5,d6
  42.     beq    .shortline
  43.     add.l    d5,a0
  44.     and    #$f,d0
  45.     lsl    #2,d0
  46.     move.l    #.leftmask,a1
  47.     move.l    (a1,d0.w),d5
  48.  
  49.     tst.l    d2
  50.     beq    .drw_a0        both zeroes
  51.     tst    d2
  52.     beq    .drw_a1        zero and one
  53.     swap    d2
  54.     tst    d2
  55.     beq    .drw_a2        one and zero
  56.     or.l    d5,(a0)+
  57.  
  58. .drw_b    tst.l    d3
  59.     beq    .drw_b0        both zeroes
  60.     tst    d3
  61.     beq    .drw_b1        zero and one
  62.     swap    d3
  63.     tst    d3
  64.     beq    .drw_b2        one and zero
  65.     or.l    d5,(a0)+
  66.  
  67. .drw_c    tst.l    d4
  68.     beq    .drw_c0        both zeroes
  69.     tst    d4
  70.     beq    .drw_c1        zero and one
  71.     swap    d4
  72.     tst    d4
  73.     beq    .drw_c2        one and zero
  74.     or.l    d5,(a0)+
  75.  
  76. .drw_d    addq.l    #4,a0
  77.     sub    d7,d1
  78.     not    d7
  79.     and    #$f,d7
  80.     sub    d7,d1
  81.     subq    #1,d1
  82.     bgt    .dl1
  83. .ut    rts
  84.  
  85. .drw_a0    not.l    d5
  86.     and.l    d5,(a0)+
  87.     not.l    d5
  88.     bra    .drw_b
  89. .drw_a2    not    d5
  90.     and    d5,(a0)+
  91.     not    d5
  92.     or    d5,(a0)+
  93.     swap    d2
  94.     bra    .drw_b
  95. .drw_a1    or    d5,(a0)+
  96.     not    d5
  97.     and    d5,(a0)+
  98.     not    d5
  99.     bra    .drw_b
  100.  
  101. .drw_b0    not.l    d5
  102.     and.l    d5,(a0)+
  103.     not.l    d5
  104.     bra    .drw_c
  105. .drw_b2    not    d5
  106.     and    d5,(a0)+
  107.     not    d5
  108.     or    d5,(a0)+
  109.     swap    d3
  110.     bra    .drw_c
  111. .drw_b1    or    d5,(a0)+
  112.     not    d5
  113.     and    d5,(a0)+
  114.     not    d5
  115.     bra    .drw_c
  116.  
  117. .drw_c0    not.l    d5
  118.     and.l    d5,(a0)+
  119.     not.l    d5
  120.     bra    .drw_d
  121. .drw_c2    not    d5
  122.     and    d5,(a0)+
  123.     not    d5
  124.     or    d5,(a0)+
  125.     swap    d4
  126.     bra    .drw_d
  127. .drw_c1    or    d5,(a0)+
  128.     not    d5
  129.     and    d5,(a0)+
  130.     bra    .drw_d
  131.  
  132.  
  133.  
  134.  
  135. * Ända ut till vänster
  136.  
  137. .dl1    tst    d1
  138.     blt    .ut
  139.     cmp    #xres-1,d1
  140.     bge    .dl2
  141.     move    d1,d0
  142.     addq    #1,d0
  143.     lsr    #4,d0
  144.     subq    #1,d0        antal 16pix
  145.     blt    .dl5
  146. .dl6    movem.l    d2-d4,(a0)    rita alla hela 16pix
  147.     add.l    #16,a0
  148.     dbra    d0,.dl6
  149.     
  150. .dl5    and    #$f,d1        rita resten
  151.     cmp    #15,d1
  152.     beq    .dl7
  153.     lsl    #2,d1
  154.     move.l    #.rightmask,a1
  155.     move.l    (a1,d1.w),d0
  156.  
  157. .rest    tst.l    d2
  158.     beq    .dl8        both zeroes
  159.     tst    d2
  160.     beq    .dl9        zero and one
  161.     swap    d2
  162.     tst    d2
  163.     beq    .dl9b        one and zero
  164.     or.l    d0,(a0)+
  165.  
  166. .dl10    tst.l    d3
  167.     beq    .dl11        both zeroes
  168.     tst    d3
  169.     beq    .dl12        zero and one
  170.     swap    d3
  171.     tst    d3
  172.     beq    .dl12b        one and zero
  173.     or.l    d0,(a0)+
  174.  
  175. .dl13    tst.l    d4
  176.     beq    .dl14        both zeroes
  177.     tst    d4
  178.     beq    .dl15        zero and one
  179.     swap    d4
  180.     tst    d4
  181.     beq    .dl15b        one and zero
  182.     or.l    d0,(a0)+
  183. .dl7    rts    
  184.  
  185. .dl8    not.l    d0
  186.     and.l    d0,(a0)+
  187.     not.l    d0
  188.     bra    .dl10
  189. .dl9b    not    d0
  190.     and    d0,(a0)+
  191.     not    d0
  192.     or    d0,(a0)+
  193.     swap    d2
  194.     bra    .dl10
  195. .dl9    or    d0,(a0)+
  196.     not    d0
  197.     and    d0,(a0)+
  198.     not    d0
  199.     bra    .dl10
  200.  
  201. .dl11    not.l    d0
  202.     and.l    d0,(a0)+
  203.     not.l    d0
  204.     bra    .dl13
  205. .dl12b    not    d0
  206.     and    d0,(a0)+
  207.     not    d0
  208.     or    d0,(a0)+
  209.     swap    d3
  210.     bra    .dl13
  211. .dl12    or    d0,(a0)+
  212.     not    d0
  213.     and    d0,(a0)+
  214.     not    d0
  215.     bra    .dl13
  216.  
  217. .dl14    not.l    d0
  218.     and.l    d0,(a0)+
  219.     rts
  220. .dl15b    not    d0
  221.     and    d0,(a0)+
  222.     not    d0
  223.     or    d0,(a0)+
  224.     swap    d4
  225.     rts
  226. .dl15    or    d0,(a0)+
  227.     not    d0
  228.     and    d0,(a0)+
  229.     rts
  230.  
  231.  
  232. * Linjen är Över hela skärmen
  233.  
  234. .dl2    move    #xres/16/2-1,d5
  235. .dl3    movem.l    d2-d4,(a0)
  236.     add.l    #16,a0
  237.     movem.l    d2-d4,(a0)
  238.     add.l    #16,a0
  239.     dbra    d5,.dl3
  240.     rts
  241.  
  242. * Linjen befinner sig i endast en 16pix
  243.  
  244. .shortline
  245.     add.l    d5,a0
  246.     move.l    #.shortmask,a1
  247.     and.l    #$f,d0
  248.     lsl    #6,d0
  249.     add.l    d0,a1
  250.     and    #$f,d1
  251.     lsl    #2,d1
  252.     move.l    (a1,d1.w),d0
  253.     bra    .rest    
  254.  
  255.  
  256.  
  257. .shortmask    dc.l    $80008000,$c000c000,$e000e000,$f000f000
  258.         dc.l    $f800f800,$fc00fc00,$fe00fe00,$ff00ff00
  259.         dc.l    $ff80ff80,$ffc0ffc0,$ffe0ffe0,$fff0fff0
  260.         dc.l    $fff8fff8,$fffcfffc,$fffefffe,$ffffffff
  261.  
  262.         dc.l    $00000000,$40004000,$60006000,$70007000
  263.         dc.l    $78007800,$7c007c00,$7e007e00,$7f007f00
  264.         dc.l    $7f807f80,$7fc07fc0,$7fe07fe0,$7ff07ff0
  265.         dc.l    $7ff87ff8,$7ffc7ffc,$7ffe7ffe,$7fff7fff
  266.  
  267.         dc.l    $00000000,$00000000,$20002000,$30003000
  268.         dc.l    $38003800,$3c003c00,$3e003e00,$3f003f00
  269.         dc.l    $3f803f80,$3fc03fc0,$3fe03fe0,$3ff03ff0
  270.         dc.l    $3ff83ff8,$3ffc3ffc,$3ffe3ffe,$3fff3fff
  271.  
  272.         dc.l    $00000000,$00000000,$00000000,$10001000
  273.         dc.l    $18001800,$1c001c00,$1e001e00,$1f001f00
  274.         dc.l    $1f801f80,$1fc01fc0,$1fe01fe0,$1ff01ff0
  275.         dc.l    $1ff81ff8,$1ffc1ffc,$1ffe1ffe,$1fff1fff
  276.  
  277.         dc.l    $00000000,$00000000,$00000000,$00000000
  278.         dc.l    $08000800,$0c000c00,$0e000e00,$0f000f00
  279.         dc.l    $0f800f80,$0fc00fc0,$0fe00fe0,$0ff00ff0
  280.         dc.l    $0ff80ff8,$0ffc0ffc,$0ffe0ffe,$0fff0fff
  281.  
  282.         dc.l    $00000000,$00000000,$00000000,$00000000
  283.         dc.l    $00000800,$04000400,$06000600,$07000700
  284.         dc.l    $07800780,$07c007c0,$07e007e0,$07f007f0
  285.         dc.l    $07f807f8,$07fc07fc,$07fe07fe,$07ff07ff
  286.  
  287.         dc.l    $00000000,$00000000,$00000000,$00000000
  288.         dc.l    $00000000,$00000000,$02000200,$03000300
  289.         dc.l    $03800380,$03c003c0,$03e003e0,$03f003f0
  290.         dc.l    $03f803f8,$03fc03fc,$03fe03fe,$03ff03ff
  291.  
  292.         dc.l    $00000000,$00000000,$00000000,$00000000
  293.         dc.l    $00000000,$00000000,$00000000,$01000100
  294.         dc.l    $01800180,$01c001c0,$01e001e0,$01f001f0
  295.         dc.l    $01f801f8,$01fc01fc,$01fe01fe,$01ff01ff
  296.  
  297.         dc.l    $00000000,$00000000,$00000000,$00000000
  298.         dc.l    $00000000,$00000000,$00000000,$00000000
  299.         dc.l    $00800080,$00c000c0,$00e000e0,$00f000f0
  300.         dc.l    $00f800f8,$00fc00fc,$00fe00fe,$00ff00ff
  301.  
  302.         dc.l    $00000000,$00000000,$00000000,$00000000
  303.         dc.l    $00000000,$00000000,$00000000,$00000000
  304.         dc.l    $00000000,$00400040,$00600060,$00700070
  305.         dc.l    $00780078,$007c007c,$007e007e,$007f007f
  306.  
  307.         dc.l    $00000000,$00000000,$00000000,$00000000
  308.         dc.l    $00000000,$00000000,$00000000,$00000000
  309.         dc.l    $00000000,$00000000,$00200020,$00300030
  310.         dc.l    $00380038,$003c003c,$003e003e,$003f003f
  311.  
  312.         dc.l    $00000000,$00000000,$00000000,$00000000
  313.         dc.l    $00000000,$00000000,$00000000,$00000000
  314.         dc.l    $00000000,$00000000,$00000000,$00100010
  315.         dc.l    $00180018,$001c001c,$001e001e,$001f001f
  316.  
  317.         dc.l    $00000000,$00000000,$00000000,$00000000
  318.         dc.l    $00000000,$00000000,$00000000,$00000000
  319.         dc.l    $00000000,$00000000,$00000000,$00000000
  320.         dc.l    $00080008,$000c000c,$000e000e,$000f000f
  321.  
  322.         dc.l    $00000000,$00000000,$00000000,$00000000
  323.         dc.l    $00000000,$00000000,$00000000,$00000000
  324.         dc.l    $00000000,$00000000,$00000000,$00000000
  325.         dc.l    $00000000,$00040004,$00060006,$00070007
  326.  
  327.         dc.l    $00000000,$00000000,$00000000,$00000000
  328.         dc.l    $00000000,$00000000,$00000000,$00000000
  329.         dc.l    $00000000,$00000000,$00000000,$00000000
  330.         dc.l    $00000000,$00000000,$00020002,$00030003
  331.  
  332.         dc.l    $00000000,$00000000,$00000000,$00000000
  333.         dc.l    $00000000,$00000000,$00000000,$00000000
  334.         dc.l    $00000000,$00000000,$00000000,$00000000
  335.         dc.l    $00000000,$00000000,$00000000,$00010001
  336.  
  337. .rightmask    dc.l    $80008000,$c000c000,$e000e000,$f000f000
  338.         dc.l    $f800f800,$fc00fc00,$fe00fe00,$ff00ff00
  339.         dc.l    $ff80ff80,$ffc0ffc0,$ffe0ffe0,$fff0fff0
  340.         dc.l    $fff8fff8,$fffcfffc,$fffefffe
  341.         
  342. .leftmask    dc.l    $ffffffff,$7fff7fff,$3fff3fff,$1fff1fff,$0fff0fff
  343.         dc.l    $07ff07ff,$03ff03ff,$01ff01ff,$00ff00ff
  344.         dc.l    $007f007f,$003f003f,$001f001f,$000f000f
  345.         dc.l    $00070007,$00030003,$00010001
  346.